/*
 * Version 0.3 by Andreas Dier
 *      Throw out unused cariables
 *      Merge and resolve conflicts
 */
package ueb13.uebOrder;

import java.io.Serializable;

/**
 *
 * @author Andreas Dier, Steffen Schuhmann
 * @version 0.3
 */
public class Order implements Serializable, Comparable<Order> {
    
    protected static final String LEERZEILE   = " ";
    protected static final String TAB         = "\t";

    protected int         orderID;
    protected String      client;
    
    
    public Order(int orderID, String client) throws OrderException {
        
        if(orderID <= 0)
            throw new OrderException();
        if (client == null)
            throw new OrderException();
        
        this.orderID = orderID;
        this.client = client;
    }
    
    public String toString() {
        StringBuilder string = new StringBuilder();
        string.append(getOrderID()).append(TAB).append(getClient());
        
        return string.toString();
    }

    @Override
    public int compareTo(Order t) {
        if(getOrderID() == t.getOrderID() && client.equals(t.getClient()))
            return 0;
        return -1;
    }

    /**
     * @return the orderID
     */
    public int getOrderID() {
        return orderID;
    }

    /**
     * @return the client
     */
    public String getClient() {
        return client;
    }
}
